﻿using System;
using DevExpress.XtraBars;
using UniMana.Data;
using UniMana.Utils.Data;
using UniMana.Utils.Helper;
namespace UniMana.Win.Leadership
{
    public partial class FrmReport_SubPersonel_Department : DevExpress.XtraEditors.XtraForm
    {

        private DBMain mReport_Personel = new DBMain();
        public FrmReport_SubPersonel_Department()
        {
            InitializeComponent();
        }
        public void InitControlEvent()
        {
            this.xucBar1.btnPrint_Click += 
                new UniMana.Utils.Controls.xucBar.ButtonClickHandler(this.btnPrint_Click);
           //this.xucBar1.btnExport_Click += 
            //new UniMana.Utils.Controls.xucBar.ButtonClickHandler(
            //    this.btnExportExcel_Click);
        }

        
        private void FrmReportPersonel_Department_Load(object sender, EventArgs e)
        {
            lueCatalogue_Department.GetData(
                mReport_Personel.m_DCReadOnly.Catalogue_Departments, chooseAll:true);
            grcPersonel.DataSource = 
                mReport_Personel.m_DCReadOnly.Personnel_Personnels.GetPersonelData(
                mReport_Personel.m_DCReadOnly.Catalogue_Degrees, 
                mReport_Personel.m_DCReadOnly.Catalogue_Departments, 
                mReport_Personel.m_DCReadOnly.Catalogue_Positions);
        }

        private void lueCatalogue_Department_EditValueChanged(object sender, EventArgs e)
        {
            grcPersonel.DataSource = 
                mReport_Personel.m_DCReadOnly.Personnel_Personnels.GetPersonelDataDep(
                mReport_Personel.m_DCReadOnly.Catalogue_Degrees, 
                mReport_Personel.m_DCReadOnly.Catalogue_Departments, 
                mReport_Personel.m_DCReadOnly.Catalogue_Positions, 
                lueCatalogue_Department.GetIntValue());
        }
        private void btnPrint_Click(object sender, ItemClickEventArgs e)
        {
            compositeLink_HienThi.ShowPreviewDialog();
        }
    }
}